source-highlight supports the following source languages: Java, C/C++, Prolog, Perl and produces an HTML file with syntax highlighting.
source-highlight is a GNU program. See COPYING.
THIS MAN PAGE IS NOT COMPLETE.
Texinfo documentation will be released soon, but meanwhile please refer to README file or to the html documentation that you can find in /usr/share/doc/source-highlight.
-h --help Print help and exit -V --version Print version and exit -iSTRING --input=STRING input file. default std input -oSTRING --output=STRING output file. default std output -sSTRING --src-lang=STRING source language (e.g. java, cpp, prolog, perl, php3, python, flex, changelog) -fSTRING --out-format=STRING output format (e.g. html, xhtml) -v --verbose verbose mode on -d --doc create html with title and header -cSTRING --css=STRING use a css for formatting. Implies --doc -TSTRING --title=STRING give a title to the html. Implies --doc -tINT --tab=INT specify tab length. default 8 -HSTRING --header=STRING file to insert as header -FSTRING --footer=STRING file to insert as footer --tags-file=STRING specify format options (def. tags.j2h) -n --line-number number all output lines --output-dir=STRING output directory
here's how to run source-highlight (for this example we will use C/C++ input files, but this is valid also for other source-highlight input languages):
source-highlight --src-lang cpp --out-format html --input <file (a C++ prog)> --output <file (an html)> [options]
For input files you can also use regular expression.
If you do not specify the name of the output file, the name will be the one of the source file with a .<ext> appended, where <ext> is the extension chosen according to the output format specified (in this example it would be .html).
You may want to specify your options for syntax highlighting in the file tags.j2h. If this file is not present in the current directory, some default colors will be used. Here's the tags.j2h file that comes with this distribution:
keyword blue b ; for language keywords type darkgreen ; for basic types string red ; for strings and chars comment brown i ; for comments number purple ; for literal numbers preproc darkblue b ; for preproc directives (e.g. #include, import) symbol darkred ; for simbols (e.g. <, >, +) function black b; for function calls and declarations cbracket red; for block brackets (e.g. {, })
tags2.j2h also specify the color of normal text, indeed it adds this line
normal darkblue ;
as you might see the syntax of this file is quite straightforward:
b = bold
i = italics
u = underline
You may also specify more than on of these options separated by commas e.g.
keyword blue u, b ;
you may see all possible colors in the file colors.html but you can also use the standard #<number> html syntax for specifying a color.
if something goes wrong with your options try to run source-highlight with --verbose option enabled.